﻿@model IEnumerable<Century.Model.CMS.SitePage>
@{
    int i = 1;
    int l = 1;
    int k = 1;
    int m = 1;
    Layout = null;
}
<div class="menuContent">
    <div class="menuInnerHeaders">
        <ul>
            @foreach (var item in Model.Where(r => r.ParentId == ViewBag.ParentPage && r.IsPublished == true && r.ShowInMenu == true && r.DraftSourcePageId <= 0).ToList().OrderBy(r => r.NodeOrder))
            {
                var pageUrl = !string.IsNullOrEmpty(item.Url) ? item.Url : item.LocalName;
                if (i == 1)
                {
                <li><a href="@pageUrl" class="@string.Format("{0}_menuheader activeInnerMenuLink menuInnerHeadersFirst", i)">
                    <span>@item.Title</span></a></li>        
                }
                else
                {
                     
                <li><a href="@pageUrl" class='@string.Format("{0}_menuheader", i)'><span>@item.Title</span></a></li>            
                }
                i++;
            }
        </ul>
    </div>
    <div class="menuBorderDiv">
    </div>
    @foreach (var item in Model.Where(r => r.ParentId == ViewBag.ParentPage && r.IsPublished == true && r.ShowInMenu == true && r.DraftSourcePageId <= 0).ToList().OrderBy(r => r.NodeOrder))
    {
        <div class='@string.Format("{0}_menuInnerContent menuInnerContent", m)' >
            @if (Model.Where(r => r.ParentId == item.Id && r.IsPublished == true && r.ShowInMenu == true && r.DraftSourcePageId <= 0).Count() > 0)
            {
                <div class="menuInnerHeaders2 menuInnerHeaders">
                    <ul>
                        @{
                          l = 1;
                         }
                        @foreach (var subItem in Model.Where(r => r.ParentId == item.Id && r.IsPublished == true && r.ShowInMenu == true && r.DraftSourcePageId <= 0).ToList().OrderBy(r => r.NodeOrder))
                        {
                            var menuItemUrl = !string.IsNullOrEmpty(subItem.Url) ? subItem.Url : subItem.LocalName;
                            if (l == 1)
                            {
                            <li><a href="@(menuItemUrl)" class='@string.Format("{0}_menuheader activeInnerMenuLink menuInnerHeadersFirst menuInnerHeadersActive", l)'>
                                <span>@subItem.Title</span></a></li>
                            }
                            else
                            {                    
                            <li><a href="@(menuItemUrl)" class='@string.Format("{0}_menuheader", l)'>
                                <span>@subItem.Title</span></a></li>
                            }
                            l++;
                        
                        }
                    </ul>
                </div>        
                <div class="menuBorderDiv">
                </div>      {
                          k = 1;
                         }          
                        foreach (var subItem in Model.Where(r => r.ParentId == item.Id && r.IsPublished == true && r.ShowInMenu == true && r.DraftSourcePageId <= 0).ToList().OrderBy(r => r.NodeOrder))
                        {
                <div class='@string.Format("{0}_menuInnerContent2 menuInnerContent", k)' >
                    <div class="menuMultiTabsContentDiv">
                        <h4>
                            @subItem.Title</h4>
                        <p>
                            @subItem.MenuDescription
                        </p>
                    </div>
                    <div class="menuBorderDiv">
                    </div>
                    <div class="menuMultiTabsImgDiv @("pimg_" + subItem.Name.Replace("-", string.Empty).ToLowerInvariant())">
                    </div>
                </div>
                            k++;
                        }
            }
            else
            {
                <div class="menuInnerContentText">
                    <h4>@item.Title</h4>
                    <p>
                        @item.MenuDescription
                    </p>
                </div>
                <div class="menuInnerContentImage @("pimg_" + item.Name.Replace("-", string.Empty).ToLowerInvariant())">
                </div>
            }
        </div>
            m++;
    }
</div>
